home *** CD-ROM | disk | FTP | other *** search
- property spriteNum, row, maxcount, myLoc
- global stock, tableau, foundation, mover, equal, currentsel, godlist, points, receiver, action
-
- on beginSprite me
- myLoc = sprite(spriteNum).loc
- sprite(spriteNum).visible = 1
- row = determinerow(spriteNum)
- receiver = 0
- if objectp(tableau[row]) = 0 then
- tableau.addProp(row, new(script("card pile")))
- end if
- if (row = #one) or (row = #two) or (row = #three) or (row = #four) then
- maxcount = 7
- else
- maxcount = 6
- end if
- if tableau[row].getcardcount() < maxcount then
- sprite(spriteNum).member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards")
- stock.cards.deleteAt(1)
- tableau[row].addCard(spriteNum)
- else
- sprite(spriteNum).visible = 0
- end if
- end
-
- on determinerow cardnumber
- if (cardnumber >= 14) and (cardnumber <= 27) then
- return #one
- else
- if (cardnumber >= 28) and (cardnumber <= 42) then
- return #two
- else
- if (cardnumber >= 43) and (cardnumber <= 56) then
- return #three
- else
- if (cardnumber >= 57) and (cardnumber <= 70) then
- return #four
- else
- if (cardnumber >= 71) and (cardnumber <= 84) then
- return #five
- else
- if (cardnumber >= 85) and (cardnumber <= 99) then
- return #six
- else
- if (cardnumber >= 100) and (cardnumber <= 113) then
- return #seven
- else
- if (cardnumber >= 114) and (cardnumber <= 127) then
- return #eight
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end
-
- on mouseDown me
- if (sprite(spriteNum).member <> member("empty", "playing cards")) and (tableau[row].getlastcard().spnum = spriteNum) then
- puppetSound(3, "pickcard")
- action = 1
- sprite(spriteNum).locZ = spriteNum + 2000
- mover = timeout("move").new(1, #moveme, me)
- end if
- end
-
- on moveme me
- sprite(spriteNum).loc = the mouseLoc
- if the stillDown = 0 then
- mover.forget()
- sprite(spriteNum).loc = myLoc
- end if
- end
-
- on mouseUp me
- sprite(spriteNum).locZ = spriteNum
- if sprite(spriteNum).member <> member("empty", "playing cards") then
- if sprite(spriteNum).loc = the mouseLoc then
- if equal = 1 then
- puppetSound(3, "pickcard")
- action = 0
- mover.forget()
- sprite(spriteNum).locZ = spriteNum
- sprite(spriteNum).loc = tableau[row].getlastcard().location
- sprite(spriteNum).locZ = spriteNum
- sprite(spriteNum).loc = tableau[row].getlastcard().location
- sprite(currentsel).member = sprite(spriteNum).member
- if tableau[row].getcardcount() > 1 then
- sprite(spriteNum).visible = 0
- else
- sprite(spriteNum).member = member("empty", "playing cards")
- end if
- if sprite(currentsel).visible = 0 then
- sprite(currentsel).visible = 1
- end if
- tableau[row].cards.deleteOne(tableau[row].getlastcard())
- godlist.addCard(currentsel)
- if (currentsel >= 10) and (currentsel <= 13) then
- points = points + 10
- end if
- equal = 0
- currentsel = 0
- godlist = VOID
- checkwin()
- else
- if equal = 0 then
- puppetSound(3, "dropcard")
- mover.forget()
- sprite(spriteNum).locZ = spriteNum
- sprite(spriteNum).loc = tableau[row].getlastcard().location
- end if
- end if
- end if
- end if
- end
-